<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=0, width=device-width"/>
	<title>api</title>
	<link rel="stylesheet" type="text/css" href="../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../css/common.css" />
	<link rel="stylesheet" type="text/css" href="../css/setting.css" />
	<style>
		.w-bar-control {
    overflow: hidden;
    position: relative;
}
.w-bar-input {
    width: 100%;
    height: 38px;
    line-height: 38px;
    background: none;
    border: none;
    color: #333;
    outline: none;
    padding: 0;
    margin: 0;
}
input {
    -webkit-appearance: none;
}
.w-switcher, .w-switcher:after {
    -webkit-transition: all .2s;
}
.w-switcher {
    position: relative;
    user-select: none;
    display: inline-block;
    vertical-align: middle;
    width: 60px;
    height: 32px;
    background: #F4F4F4;
    border: 1px solid #D5D5D5;
    border-radius: 32px;
}
.w-bar-ext {
    color: #A9A9A9;
}
.w-bar-ext {
    float: right;
    color: #a9a9a9;
 margin-right: 6px;
}
.w-switcher:after {
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
    border-radius: 100%;
    content: "";
}
.w-switcher, .w-switcher:after {
    -webkit-transition: all .2s;
}
.w-checkBar-checked .w-switcher, .w-switcher-on {
    background: #ff0000;
    border-color: #ff0000;
}
.w-switcher, .w-switcher:after {
    -webkit-transition: all .2s;
}
.w-checkBar-checked .w-switcher:after, .w-switcher-on:after {
    left: 28px;
}
	</style>
</head>
<body>
	<div id="setting">
	<header id='header'>
        
           
           <div class="header">
                <i id='back' class="back" onclick="back()"></i><h1>设置</h1>
                
            </div>
            
        
        
        </header>
      <!--   <script id="set-template" type="text/x-dot-template">
        {{if(it!=null){}}
        {{if(it.status=='Y'){}}
        	<li class='w-checkBar w-bar w-checkBar-checked' id="check" data='Y' onclick="checkBox()" style='margin-top: 12px;' class="z-li"><a ><span style="float:right;margin-right: -14px;" id="a_st">
                <div class="w-bar-ext"><b data-pro="switcher" class="w-switcher"></b>
                </div></span>揭晓通知</a></li>
        {{}else{}}
        <li class='w-checkBar w-bar ' id="check" data='N' onclick="checkBox()" style='margin-top: 12px;' class="z-li"><a ><span style="float:right" id="a_st">
                <div class="w-bar-ext"><b data-pro="switcher" class="w-switcher"></b>
                </div></span>揭晓通知</a></li>
        {{}}}
        {{}}}
        </script> -->
		<div class="m-round m-member-nav">
            <ul id="ulFun">
               
                <li onclick="openUrl('http://m.jqmao.cn/?/mobile/mobile/about','常见问题')"><a><b class="z-arrow"></b>常见问题</a></li>
                <li><a ><b class="z-arrow"></b><span style="float:right" id="v_status"></span>应用版本</a></li>
                <li onclick="openUrl('http://m.jqmao.cn/?/mobile/mobile/about','关于猫购')"><a ><b class="z-arrow"></b>关于猫购</a></li>
                <li onclick="clearCache()" class="z-li" style='margin-top: 12px;' ><a ><b class="z-arrow"></b><span style="float:right" id="a">0MB</span>清除缓存</a></li>
                <li class="z-li" onclick="quit()"><a  id="btnLogout" style='text-align: center;'>退出登录</a></li>
            </ul>
        </div>
	</div>
</body>
	
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/doT.min.js"></script>
	<script type="text/javascript" src="../script/common.js"></script>
	<script type="text/javascript">
	var uid = null;
		apiready = function(){
		headerstatus();
		if($api.getStorage('user')){
			uid = $api.getStorage('user').uid;
		}
	
//		api.ajax({
//	        url:'http://wap.jqmao.cn/queryPush?uid='+uid
//      },function(ret,err){
//      	//coding...
//      	var content = $api.byId('ulFun');
//          var tpl = $api.byId('set-template').text;
//          var tempFn = doT.template(tpl);
//          $api.prepend(content, tempFn(ret));
//      	
//      });
		
		   
		var size = api.getCacheSize({
    		sync: true
		});
		
		var mb_size = parseInt((size/1024)/1024);
		$api.html($api.byId('a'),mb_size+'MB');
		
		    var appVersion = api.appVersion;
		    //alert(appVersion)
		    var v_status = $api.byId('v_status');
		    $api.html(v_status,appVersion);
		}
		function clearCache(){
			api.clearCache(function() {
		    api.toast({
		        msg: '清除完成'
		    });
		    $api.html($api.byId('a'),'0MB');
			});
		}
		function checkBox(){

			var checkbox = $api.byId('check');
			var checkdata = $api.attr(checkbox, 'data');
			if(checkdata=='Y'){
				//关闭揭晓通知
				$api.removeCls(checkbox, 'w-checkBar-checked');
				$api.attr(checkbox, 'data', 'N');
				api.ajax({
	                url:'http://wap.jqmao.cn/updatePush?uid='+uid
                },function(ret,err){
                	//coding...
                });			
			}else{
				//开启揭晓通知	
				api.ajax({
	                url:'http://wap.jqmao.cn/updatePush?uid='+uid
                },function(ret,err){
                	//coding...
                });			
				$api.attr(checkbox, 'data', 'Y');
				$api.addCls(checkbox, 'w-checkBar-checked');
			}
		}
		    
	</script>
	
</html>